#include"include/allinall_datatype.hpp"
#include<cstring>
#include<cstdlib>
datablock::datablock(const char*call,size_t n=0){
	size_t lenth=strlen(call)+1;
	name=new char[lenth];
	strncpy(name,call,lenth);
	size=n;
	cycle=0;
	data=(float*)malloc(sizeof(float)*n);
}

datablock::~datablock(){
	free(data);
	delete name;
}

void datablock::load(float*data,size_t n){
	++cycle;
	if(size<n||cycle==5){
		this->data=(float*)realloc(this->data,n);
		cycle=0;
	}
	for(int i=0;i<n;++i)
		this->data[i]=data[i];
}